<template>
    <view class="content">
        <view class="box" v-for="(item, index) in list" :key="index" @click="$gTo(`./details?id=${item.id}`)">
			<view>
				<view class="item">
					<view class="left">用户姓名</view>
					<view class="u-flex u-flex-1">
						<view class="right">{{item.nickname}}</view>
						
						<view class="sta sta2" v-if="item.status == 0">{{item.status_txt}}</view>
						<view class="sta" v-else>{{item.status_txt}}</view>
					</view>
				</view>
				<view class="item">
					<view class="left">用户关系</view>
					<view class="right">{{item.relation}}</view>
				</view>
				<view class="item">
					<view class="left">时间</view>
					<view class="right">{{item.report_time}}</view>
				</view>
			</view>
			<view class="down" v-if="item.content">
				<view class="title">
					<image src="../../static/icon/icon_3.png" class="icon-3"></image>
					<view>体检报告解读</view>
				</view>
				<view class="u-line-1">{{item.content}}</view>
			</view>
		</view>
		
		<view style="height: 94rpx;padding-top: 30rpx;">
		    <u-loadmore :status="status" v-if="status != 'loadmore'" />
		</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                status: 'loadmore', //是否显示没有更多了
                page: 1,
                list: [],
            };
        },
        onShow() {
        	this.list = []
        	this.page = 1
        	this.status = 'loadmore'
        	this.getList()
        },
        onReachBottom() {
        	if(this.page == 1){return}
        	this.getList()
        },
        methods: {
            getList() {
            	if (this.status == 'nomore') return;
            	this.status = 'loading';
            	this.$ajax('staff_reports_list', {
                    userToken: this.$getSync('userToken'),
                    page: this.page,
                    limit: 10,
                }).then(ret => {
            		if (ret.status == 0) {
                        if (ret.data.length > 0) {
                        	this.list = this.list.concat(ret.data);
                        	this.page++;
                        	this.status = 'loadmore'
                        } else {
                        	this.status = 'nomore'
                        }
            		} else {
            			this.$toast(ret.message);
            		}
            	});
            },
        }
    };
</script>

<style lang="scss">
	
	
	
	
    page{
        background-color: #f5f5f5;
    }
	.content{
		padding: 20rpx;
	}
	.box{
		padding: 40rpx 32rpx;
		background-color: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		font-size: 26rpx;
	}
	.item{
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-bottom: 14rpx;
	}
	.item:last-child{
		padding-bottom: 0;
	}
	.left{
		width: 130rpx;
		color: #8e8e8e;
	}
	.right{
		flex: 1;
		text-align: left;
		color: #000;
	}
	.sta{
		font-size: 22rpx;
		color: #01b6bc;
		padding: 6rpx 12rpx;
		background-color: #e8f8f9;
		border-radius: 4rpx;
		margin-left: 15rpx;
	}
	.sta2{
		color: #fe8928;
		background-color: #fff2e8;
	}
	
	.down{
		font-size: 26rpx;
		margin-top: 20rpx;
		padding-top: 20rpx;
		border-top: 2rpx solid #e6e6e6;
	}
	.title{
		display: flex;
		justify-content: flex-start;
		align-items: center;
		font-size: 28rpx;
		font-weight: bold;
		padding-bottom: 10rpx;
	}
	.icon-3{
		width: 32rpx;
		height: 28rpx;
		margin-right: 8rpx;
	}
	
	
	

</style>
